package com.abdulaziz.ms.ocv.gef.editor.policy;



import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy;
import org.eclipse.gef.requests.CreateConnectionRequest;
import org.eclipse.gef.requests.ReconnectRequest;

import com.abdulaziz.ms.OCV.UMLClass;
import com.abdulaziz.ms.OCV.UMLLink;
import com.abdulaziz.ms.ocv.gef.editor.command.OCVLinkCreateCommand;

public class OCVClassGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {

	@Override
	protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
		OCVLinkCreateCommand command = (OCVLinkCreateCommand)request.getStartCommand();
		command.setTargetClass((UMLClass) getHost().getModel());
		
		return command;
	}

	@Override
	protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
		OCVLinkCreateCommand command = new OCVLinkCreateCommand();
		command.setSourceClass((UMLClass) getHost().getModel());
		command.setUmlLink((UMLLink) request.getNewObject());
		command.setParentUMLClassDiagram(((UMLClass) getHost().getModel()).getUmlDiagram() );
		request.setStartCommand(command);
		return command;
	}

	@Override
	protected Command getReconnectTargetCommand(ReconnectRequest request) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected Command getReconnectSourceCommand(ReconnectRequest request) {
		// TODO Auto-generated method stub
		return null;
	}

}
